from formats.wavread import wav_read  
from formats.wavwrite import wav_write  
from formats.aiffread import aiff_read  
from formats.aiffwrite import aiff_write  
from formats.auread import au_read  
from formats.auwrite import au_write  
from effects.echo import apply_echo  
from effects.surround import apply_surround  
from effects.reverse import reverse_audio  
from filters.equalizer import apply_equalizer  
from filters.vocoder import apply_vocoder  
from filters.karaoke import apply_karaoke_effect   
  
def main():  
    # 读取 WAV 文件  
    wav_data = wav_read("example.wav")  
    # 应用回声效果  
    echo_data = apply_echo(wav_data, delay=0.5, decay=0.4)  
    # 应用环绕声效果  
    surround_data = apply_surround(echo_data) 
    # 反转音频  
    reversed_data = reverse_audio(surround_data)  
    # 应用均衡器  
    equalized_data = apply_equalizer(reversed_data, bands=[60, 170, 310, 600, 1000, 3000, 6000, 12000])  
    # 应用声码器  
    vocoded_data = apply_vocoder(equalized_data, params={"rate": 16000, "frames": 1024})  
    # 应用卡拉OK效果  
    karaoke_data = apply_karaoke_effect(vocoded_data)  
    # 写入 AIFF 文件  
    aiff_write(karaoke_data, "output.aiff")  
    # 读取 AIFF 文件  
    aiff_data = aiff_read("output.aiff")  
    # 写入 AU 文件  
    au_write(aiff_data, "output.au")  
  
if __name__ == "__main__":  
    main()